package org.netty.framework.core.concurrent;

import io.netty.util.NettyRuntime;

/**
 * 实现了公共的创建业务线程池的方法
 * @author chenfanglin
 * @date 2018年9月26日下午5:55:41
 */
public abstract class AbstractNettyThreadPool implements NettyThreadPool{

	/**
	 * 创建业务线程池
	 * @param poolName
	 * @return
	 */
	public NettyServerThreadPoolExecutor createThreadPoolExecutor(String poolName) {
		NettyServerThreadPoolExecutor nettyServerThreadPoolExecutor = new NettyServerThreadPoolExecutor(poolName);
		nettyServerThreadPoolExecutor.setCorePoolSize(NettyRuntime.availableProcessors() * 2);
		nettyServerThreadPoolExecutor.setMaxPoolSize(NettyRuntime.availableProcessors() * 8);
		nettyServerThreadPoolExecutor.setQueueCapacity(1000000);
		return nettyServerThreadPoolExecutor;
	}
	
}
